import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application
import jme3.JME3DApp

fun main() = application {
    Window(onCloseRequest = ::exitApplication) {
        JME3DApp()
    }
}

//fun main() {
//    HelloJOGL().setup("Hello JOGL", GLProfile.GL2)
//}

//可以直接使用Swing编码，在环境上是Swing的超集
//private fun main() {
//    //Creates an empty window and set its size and defaultCloseOperation
//    val frame = JFrame()
//    frame.setSize(400, 600)
//    frame.title = "Swing Application"
//    frame.defaultCloseOperation = JFrame.EXIT_ON_CLOSE
//
//    //Creates a Menu bar and adds menu items in the menu bar
//    val menuBar = JMenuBar()
//    val menu1 = JMenu("File")
//    val menu2 = JMenu("Edit")
//    val menu3 = JMenu("Selection")
//    menuBar.add(menu1)
//    menuBar.add(menu2)
//    menuBar.add(menu3)
//
//    //creates a JPanel and adds the label and button in it
//    val pane = JPanel()
//    val button = JButton("Click me")
//    val label = JLabel("Click the Button")
//    pane.add(button)
//    pane.add(label)
//
//    //setting up the menu bar and JPanel in the window using border layout
//    frame.contentPane.add(BorderLayout.NORTH, menuBar)
//    frame.contentPane.add(BorderLayout.CENTER, pane)
//    frame.isVisible = true
//
//
//    val canvas = Canvas()
//    pane.add(canvas);
//
//    canvas.setSize(300, 200)
//    canvas.isVisible = true
//    canvas.isFocusable = false
////Putting it all together.
//    canvas.createBufferStrategy(3)
//    val running = true
//    var bufferStrategy: BufferStrategy
//    var graphics: Graphics
//    while (running) {
//        bufferStrategy = canvas.bufferStrategy
//        graphics = bufferStrategy.drawGraphics
//        graphics.clearRect(0, 0, 300, 200)
//        graphics.drawString(
//            "This is some text placed in the top left corner.",
//            5,
//            15
//        )
//        bufferStrategy.show()
//        graphics.dispose()
//    }
//}

//使用ComposePanel，在Swing中使用Compose组件
//fun main() = SwingUtilities.invokeLater  {
//    //Creates an empty window and set its size and defaultCloseOperation
//    val jFrame = JFrame()
//    setDefaultLookAndFeelDecorated(true)
//    jFrame.defaultCloseOperation = WindowConstants.EXIT_ON_CLOSE
//    jFrame.title = "Swing App"
//    jFrame.isVisible = true
//    jFrame.setSize(600, 600)
//
//    /*creates a ComposePanel with JButtons and then
//     adds them to the JFrame using border layout*/
//
//    val panel = ComposePanel()
//    jFrame.contentPane.add(panel, BorderLayout.CENTER)
//    jFrame.contentPane.add(JButton("Swing Button 1"), BorderLayout.NORTH)
//    jFrame.contentPane.add(JButton("Swing Button 2"), BorderLayout.EAST)
//    jFrame.contentPane.add(JButton("Swing Button 3"), BorderLayout.WEST)
//    val canvas = RawSwingCanvas()
//    jFrame.contentPane.add(canvas, BorderLayout.SOUTH)
//    panel.setContent { AppDesktopPreview() }
//}
//// preview 依赖于ide
//@Preview
//@Composable
//fun AppDesktopPreview() {
//    App()
//}